<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" title="模板" id="operateTpl">
	{{# if(d.msuInfo.status == 0){ }}
    	<span class="green">释放 {{ d.msuInfo.metre }}米</span>
	{{# }else if(d.msuInfo.status == 1){ }}
		<span class="yellow">占用{{ d.msuInfo.metre }}米</span>
	{{# }else{ }}
		<span class="blue">实际使用{{ d.msuInfo.true_metre }}米</span>
	{{# } }}
</script>

<script type="text/html" id="createTimeTpl">
    <div>{{layui.util.toDateString(d.create_time * 1000) }}</div>
</script>

<script type="text/javascript">
    layui.use(['table', 'tool'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url("", ["id" => $id])}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                {field: 'update_time', title: '操作时间',templet: '#createTimeTpl'}
                ,{field: 'factory_name', title: '工厂'}
                ,{field: 'client_ordernum', title: '来源订单号', templet:function(d){return '<span class="copy-item">'+d.client_ordernum+'</span>'}}
                ,{field: 'client_ordernum_use', title: '占用订单号', templet:function(d){return '<span class="copy-item">'+d.client_ordernum_use+'</span>'}}
                ,{field: 'storehouse_name', title: '货仓'}
                ,{field: 'storeshelf_name', title: '货架'}
                ,{field: '', title: '操作', templet:"#operateTpl"}
            ]]
        });
    });
</script>